import PopupListButton from './PopupListButton'
import PopupEditButton from './PopupEditButton'
import WindowButton from './WindowButton'
import PopupBillNumberList from './PopupBillNumberList'

export default class FnaSpecial extends React.Component{

	constructor(props) {
		super(props);	
    }

    componentDidMount() {
		//一些初始化请求
	}

	componentWillReceiveProps(nextProps) {
		//console.log("componentWillReceive_this.props", this.props);
		//console.log("componentWillReceive_nextProps", nextProps);
	}

	shouldComponentUpdate(nextProps, nextState) {
		//console.log("shouldComponentUpdate_this.props", this.props);
		//console.log("shouldComponentUpdate_nextProps", nextProps);
		//console.log("shouldComponentUpdate_this.state", this.state);
		//console.log("shouldComponentUpdate_nextState", nextState);
		return true;
	}

	componentWillUnmount() {
		//组件卸载时一般清理一些状态
		
	}


    render(){
		const {fnaParam,wfInfo,fieldObj,rowIndex,viewAttr,fieldValue,fieldid,detailKeyid} = this.props;

    	const requestid = wfInfo.requestid;
    	const type = fnaParam.type;
    	const nodeType = wfInfo.nodetype;

    	let fieldGet = fnaParam.fieldGet;
    	let fieldSet = fnaParam.fieldSet;
		let detailList = fnaParam.detailList;
		let detailType = fnaParam.detailType;
  
    	let contentHtml = "";
    	switch(type){
			case 1://按钮弹出列表
				contentHtml = [<PopupListButton ecId={`${this && this.props && this.props.ecId || ''}_PopupListButton@y0frgy@${type}`} 
					detailRecordId={detailKeyid}
					requestid={requestid}
				 	/>];	
				break;
			case 2://按钮弹出编辑框
			
				contentHtml = [<PopupEditButton ecId={`${this && this.props && this.props.ecId || ''}_PopupEditButton@j6vgti@${type}`}
	            	fieldId={fieldid}
	            	fieldSet={fieldSet}
	            	fieldGet={fieldGet}
	            	rowIndex={rowIndex}
	            	loanAmount={fieldValue}
					viewAttr={viewAttr}
	            	nodeType={nodeType}
	            	wfInfo={wfInfo}
	            	/>];

				break;
			case 3://按钮弹出新页面
				
				contentHtml = [<WindowButton ecId={`${this && this.props && this.props.ecId || ''}_WindowButton@z7cym8@${type}`}
	            	detailRecordId={detailKeyid}
	            	requestid={requestid}
	            	/>];
				break;
			case 5://单内序号列表
				
				contentHtml = [<PopupBillNumberList ecId={`${this && this.props && this.props.ecId || ''}_PopupBillNumberList@exe9x6@${type}`}	
	                requestid={requestid}
	                fieldId={fieldid}
	                fieldGet={fieldGet}
					fieldSet={fieldSet}
	                rowIndex={rowIndex}
	                detailList={detailList}
					nodeType={nodeType}
					detailType={detailType}
					viewAttr={viewAttr}
					value={fieldValue}
					/>];
				break;
			default:
				contentHtml= "";
		}

 		return(
 			<div id="fnaSpecial" >
				{contentHtml}
			</div>
 		);
    }

}

